﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SharedCode;
using AdminModule.IndexMarkServiceReference;
using System.Collections.ObjectModel;
//using AdminModule.StandardClassesExtensions;

namespace AdminModule.ViewModels
{
    public class EditCategoryWeightVM : ViewModelBase
    {
        private IndexMarkServiceClient client = new IndexMarkServiceClient();
        private ObservableCollection<AdmCategory> categories = new ObservableCollection<AdmCategory>();
        public ObservableCollection<AdmCategory> Categories
        {
            get
            {
                return this.categories;
            }
            set
            {
                this.categories = value;
            }
        }

        public override void Init()
        {
            base.Init();
            client.GetAdmCategoriesCompleted += (s, ev) =>
            {
                categories.Clear();
                categories.LoadWithClear<AdmCategory>(ev.Result);
                this.RaiseInitCompleted();
            };
            client.GetAdmCategoriesAsync();
        }
    }
}
